package main

import "MqttCloudProtocolServer/publiclib/logiclib"

func getStatue(processName string, processes []logiclib.ProcessBase) string {
	for _, p := range processes {
		if p.GetTitle() == processName {
			return p.GetRunningStatue()
		}
	}
	return "fault"
}
func startAll(processes []logiclib.ProcessBase) string {
	for _, p := range processes {
		p.Start()
	}
	return "success"

}
func stopAll(processes []logiclib.ProcessBase) string {
	for _, p := range processes {
		p.Stop()
	}
	return "success"

}
func startDaemon(processes []logiclib.ProcessBase) string {
	for _, p := range processes {
		p.SetIsDaemon(true)
	}
	return "success"

}
func stopDaemon(processes []logiclib.ProcessBase) string {
	for _, p := range processes {
		p.SetIsDaemon(false)
	}
	return "success"

}
func startProcess(processName string, processes []logiclib.ProcessBase) string {
	for _, p := range processes {
		if p.GetTitle() == processName {
			p.Start()
			return "success"
		}
	}
	return "fault"

}
func stopProcess(processName string, processes []logiclib.ProcessBase) string {
	for _, p := range processes {
		if p.GetTitle() == processName {
			p.Start()
			return "success"
		}
	}
	return "fault"

}
